function open_persons(type) {
   link = base_url + 'admin_manage_persons/simple.html';
   win = window.open(link, 'persons', 'height=600,width=530,scrollbars=yes');
   return false;
}
function add_person(id, title, type) {
   el = '<div rel="' + type + '" rev="' + id + '"><a href="#" onclick="return remove_person(' + id + ', \'' + type + '\')" title="Удалить">[X]</a> ' + title + '</div>';
   jQuery('#' + type + '-container').append(el);
   return false;
}
function remove_person(id, type) {
   jQuery('[rel=' + type + '][rev=' + id + ']').remove();
   return false;
}
function submit_persons(type) {
   var ids = '';
   jQuery('[rel=' + type + ']').each(
      function () {
         ids += jQuery(this).attr('rev') + '-';
      }
   );
   jQuery('#' + type).val(ids);
}
